package com.yihuan.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

@RestController
public class RemoveController {
    private Map<String, Object> map = new HashMap<>();
    
    /**
     * 退出系统
     *
     * @param session
     * @return
     */
    @RequestMapping("/remove_4")
    public Map<String, Object> remove(HttpSession session) {
        //存储登录账号昵称
        session.removeAttribute("UserNickname_4");
        //存储登录账号
        session.removeAttribute("UserLoginName_4");
        //存储登录账号的姓名
        session.removeAttribute("UserID_4");
        map.put("code", 200);
        map.put("explain ", "=====退出系统成功=====");
        return map;
    }
    
    /**
     * 退出系统
     *
     * @param session
     * @return
     */
    @RequestMapping("/remove_3")
    public Map<String, Object> remove3(HttpSession session) {
        //存储登录账号昵称
        session.removeAttribute("UserNickname_3");
        //存储登录账号
        session.removeAttribute("UserLoginName_3");
        //存储登录账号的姓名
        session.removeAttribute("UserID_3");
        map.put("code", 200);
        map.put("explain ", "=====退出系统成功=====");
        return map;
    }
    
    /**
     * 退出系统
     *
     * @param session
     * @return
     */
    @RequestMapping("/remove_seller")
    public Map<String, Object> remove_seller(HttpSession session) {
        //存储登录账号昵称
        session.removeAttribute("SellerNickname");
        //存储登录账号
        session.removeAttribute("SellerLoginName");
        //存储登录账号的姓名
        session.removeAttribute("SellerID");
        map.put("code", 200);
        map.put("explain ", "=====退出系统成功=====");
        return map;
    }
    
    /**
     * 退出系统
     *
     * @param session
     * @return
     */
    @RequestMapping("/remove_user")
    public Map<String, Object> remove_user(HttpSession session) {
        //存储登录账号昵称
        session.removeAttribute("UserNickname");
        //存储登录账号
        session.removeAttribute("UserLoginName");
        //存储登录账号的姓名
        session.removeAttribute("UserID");
        map.put("code", 200);
        map.put("explain ", "=====退出系统成功=====");
        return map;
    }
}
